We all love listening to music and watching videos, whether it’s at the gym, at work, or relaxing at home, multimedia content is part of our daily life. Everyone has their own collection of favorite videos and music, and there’s always something new to add.
While there are streaming services like Spotify and YouTube itself, many people still prefer downloading their own content for offline access, better quality control, and organizing their personal media libraries.
Today, we’re going to show you how to easily download both videos and audio tracks from YouTube using yt-dlp – a feature-rich command-line audio/video downloader for Linux.
yt-dlp is an actively maintained fork of youtube-dl, a popular command-line tool for downloading videos from various websites and it offers enhanced features, frequent updates, bug fixes, and support for thousands of sites beyond just YouTube.
While youtube-dl development has significantly slowed down over the years, yt-dlp continues to receive regular updates and remains the recommended choice for downloading videos and audio from YouTube and other supported platforms.
In this tutorial, you will learn how to download videos in various formats, extract MP3 tracks from YouTube videos, download entire playlists, and more. First, you’ll need to install yt-dlp on your system.
Install yt-dlp – A YouTube Video Downloader for Linux
The package yt-dlp is available for RHEL-based and Debian-based distributions, and it can be easily installed by using your favorite package manager.
Important: yt-dlp requires Python 3.10 or higher to function properly.
sudo apt install yt-dlp [On Debian, Ubuntu and Mint] sudo yum install yt-dlp [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] sudo emerge -a sys-apps/yt-dlp [On Gentoo Linux] sudo apk add yt-dlp [On Alpine Linux] sudo pacman -S yt-dlp [On Arch Linux] sudo zypper install yt-dlp [On OpenSUSE]
Alternatively, to install the most latest version of yt-dlp, use the following curl or wget to download the official binary file for your operating system.
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
Or using wget:
sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
Install FFmpeg (Highly Recommended)
For the best experience with yt-dlp, especially when merging video and audio streams or converting formats, you should also install ffmpeg:
sudo apt install ffmpeg [On Debian, Ubuntu and Mint] sudo yum install ffmpeg [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] sudo pacman -S ffmpeg [On Arch Linux]
Getting Started with yt-dlp
The yt-dlp command has an extensive help page and to view it, simply type:
yt-dlp --help
If you’re looking for a specific option, use the grep command to search for a specific keyword:
yt-dlp --help | grep format
Download Videos in Best Available Quality
To download a video in the best available quality (video + audio), simply run:
yt-dlp https://www.youtube.com/watch?v=VIDEO_ID
By default, yt-dlp will download the video in the best quality available and merge the video and audio streams automatically.
Download Videos in a Specific Format
To download a video in a specific format like MP4, use:
yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" https://www.youtube.com/watch?v=VIDEO_ID
Or use the simpler --remux-video option to ensure the output is in MP4 format:
yt-dlp --remux-video mp4 https://www.youtube.com/watch?v=VIDEO_ID
Before downloading, you can list all available formats for a video:
yt-dlp -F https://www.youtube.com/watch?v=VIDEO_ID
This will show you all available video and audio formats with their quality, codec, and file size information. You can then select a specific format using its format code:
yt-dlp -f 137+140 https://www.youtube.com/watch?v=VIDEO_ID
Download MP3 Songs from YouTube Videos
Now, let’s focus on extracting audio from YouTube videos.
To download a video as an MP3 track, you’ll need the following two options:
--extract-audio(short option-x) – Converts video files to audio-only files.--audio-format– Specifies the audio format for the downloaded file.
The supported audio formats are best, aac, alac, flac, m4a, mp3, opus, vorbis, and wav; best is set by default.
Download YouTube Video as an MP3 Song
To download a video as an MP3 file, use the following command:
yt-dlp -x --audio-format mp3 https://www.youtube.com/watch?v=VIDEO_ID
Add Cover Art to MP3 Files
If you want to embed the cover art (thumbnail) in the MP3 file, add the --embed-thumbnail option:
yt-dlp -x --embed-thumbnail --audio-format mp3 https://www.youtube.com/watch?v=VIDEO_ID
Download High-Quality Audio
For the best audio quality, you can specify the audio quality using the --audio-quality option (0 being the best, 10 the worst):
yt-dlp -x --audio-format mp3 --audio-quality 0 https://www.youtube.com/watch?v=VIDEO_ID
Alternatively, download in a lossless format like FLAC for the highest quality:
yt-dlp -x --audio-format flac https://www.youtube.com/watch?v=VIDEO_ID
Download All Videos from a YouTube Playlist
YouTube playlists are extremely popular, and you can download entire playlists with a single command:
yt-dlp https://www.youtube.com/playlist?list=PLAYLIST_ID
Download Playlist as MP3 Songs
To download all songs from a playlist as MP3 files:
yt-dlp -x --audio-format mp3 https://www.youtube.com/playlist?list=PLAYLIST_ID
Download Specific Range from a Playlist
You might want to download only specific videos from a playlist, and for that purpose, use the following options:
--playlist-start NUMBER– Playlist video to start at (default is 1).--playlist-end NUMBER– Playlist video to end at (default is last).
The command below will download the first 5 items from the playlist:
yt-dlp -x --audio-format mp3 --playlist-start 1 --playlist-end 5 https://www.youtube.com/playlist?list=PLAYLIST_ID
Download from Multiple Playlists
To download from multiple playlists, create a text file (e.g., playlists.txt) and add the URLs of the playlists you want to download, one per line:
https://www.youtube.com/playlist?list=PLAYLIST_ID_1 https://www.youtube.com/playlist?list=PLAYLIST_ID_2 https://www.youtube.com/playlist?list=PLAYLIST_ID_3
Then run:
yt-dlp -x --audio-format mp3 -i --batch-file='path/to/playlists.txt'
The -i flag tells yt-dlp to ignore errors and continue downloading even if some videos are unavailable.
Custom Output Filename Template
By default, yt-dlp uses the video title as the filename, but you can customize this using the -o option:
yt-dlp -o "%(uploader)s - %(title)s.%(ext)s" https://www.youtube.com/watch?v=VIDEO_ID
This will save files as “Channel Name – Video Title.mp4“.
Download Video with Subtitles
To download a video along with its subtitles:
yt-dlp --write-subs --sub-lang en https://www.youtube.com/watch?v=VIDEO_ID
To embed subtitles directly into the video file:
yt-dlp --embed-subs --sub-lang en https://www.youtube.com/watch?v=VIDEO_ID
Download Only New Videos
If you’re regularly downloading from a channel or playlist, you can use a download archive to avoid re-downloading videos:
yt-dlp --download-archive downloaded.txt https://www.youtube.com/playlist?list=PLAYLIST_ID
This creates a file that tracks which videos you’ve already downloaded, skipping them on subsequent runs.
Limit Download Speed
To limit the download speed (useful if you don’t want to consume all your bandwidth):
yt-dlp --limit-rate 1M https://www.youtube.com/watch?v=VIDEO_ID
Update yt-dlp to the Latest Version
yt-dlp can update itself to the latest version using the built-in update command:
yt-dlp -U
Note: The latest stable release as of March 2026 is version 2026.03.13 GitHub. The project receives frequent updates with new features, bug fixes, and support for site changes.
For the most recent fixes and features, you can also use the nightly builds:
yt-dlp --update-to nightly
Conclusion
yt-dlp is a powerful, feature-rich command-line tool that makes downloading videos and audio from YouTube incredibly straightforward. Whether you want to build your offline music library, save educational videos, archive your favorite content, or download entire playlists, yt-dlp has you covered.
The tool continues to receive active development and regular updates, ensuring it remains compatible with YouTube’s frequent changes and adds support for new features and websites.
You’re now equipped with the knowledge to download videos in various formats, extract high-quality audio, manage playlists, and customize downloads to suit your needs.
If you have any questions or comments, please feel free to share them in the comment section below.






I have a lot of high-quality music videos. You may extract and save music for later use using download. To entertain yourself or to share with others, it’s up to you. When there is no 4G or 5G signal, you can use it without a problem.
You can refer to it at:
https://kostenloseklingeltone.de/Have you tried the NoteBurner YouTube Video Downloader? It could be the best free YouTube to MP3 Downloader for those who want to export audio from YouTube videos. The sound quality also sounds the same as the original songs.
Attempting to download the mp3 files, I find your instructions are incomplete:
`ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.`
Thanks!
Hi, Marin. Thanks for your considerate sharing. But I have to admit that commands are too complicated for me to understand. I usually use an online program called 2conv and offline software called Joyoshare Screen Recorder.
2conv is more convenient, but when it comes to some YouTube videos that claim copyright protection, it won’t work. And it has few supported formats. Joyoshare program works with most formats and can record videos in 1080P with or without sound. Glad to share it for those beginners.
Didn’t work for me, no matter which links I pasted, it returns “YouTube said: This video is unavailable.”
Hello there. Don’t lose faith in Youtube-dl :)
You probably just need to update the program itself. try
youtube-dl -Uand if that doesn’t work, delete your current installation and reinstall it.youtube-dl doesn’t work when the video has age restriction, it doesn’t matter if you put your credentials, not a good tool
I am getting Http Error 429: Too Many Requests
Any solution?
Regards
You can use the
--batch-file FILEoption or-afor short if you want to use the text file with multiple links. It is very much simpler than the loop.I get the same thing. Error: YouTube said: This video is unavailable“.
@Geroge,
It worked for me, I tried to download
https://www.youtube.com/watch?v=bqWDLQVpHzkand it worked for me.I get the same thing
https://www.youtube.com/watch?v=bqWDLQVpHzk.Hi! I started using youtube-dl for my raspberry pi. It was working fine yesterday (Dec 26th) but every attempt to download a video today returns “Error: YouTube said: This video is unavailable“.
Just update or reinstall again
Thank you. I have been using AudFree software to download and convert music to MP3 and other common formats. It is compatible with almost all kinds of music resources from Apple Music, Spotify, Tidal, YouTube, which completely fulfill my needs.
Thanks! I used DRmare software download audios from YouTube videos.
Can this also download the comments associated with a youtube video?
@Ubaldo,
No, you can’t download the comments of Youtube videos.
I used this page ytpick(dot)com/youtube-music/ very easy, URL and Download the music
I use Allavsoft to download YouTube to MP4, MP3, WAV, etc
ERROR: This video contains content from UMG, who has blocked it on copyright grounds.
How do you remove errors like the one above mentioned?
This appears in case i try to download a playlist and a song is deleted, the program stops abruptly and I need to edit the start playlist command in order to skip the song manually but if it finds another one it needs to be done again and again
Do I need to build a script similar to the one you showcased so that in case of error it skips song or is there a pre built skip to next in this useful tool?
This is perfect for what I was looking for. Thanks for the sharing. I used to download mp3 song from Youtube video with acethinker video keeper, free and works fairly well. Share it here as an alternative to YouTube-DL.
It is so easy to download MP3 with CL tool. Further you can change bit rate & other things.
nice guide
I would like to see some comments to determine if this tool is real or if it is malicious software?
I’m using this tool for almost a year and i don’t think its a malicious software.
Oh yes, thank you!
I’m taking my first steps with Slackware distro and I’m having fun doing many things on the terminal. So getting mp3 from youtube using command line is also great!
Today I used the following command:
# youtube-dl --embed- thumbnail --write-- thumbnail -x audio -format mp3 ((URL)- | youtube-dl --write-sub (URL)
youtube-dl downloaded two files one audio & one video file is this wrong?
The WonderFox free hd I am using is a very good YouTube downloader and converter that makes it easy to download the music we want from YouTube and convert it to MP3 format. You can have a try!
Quick question, can this program include an id3tag in the mp3 file?
Great article and great tool! I use it almost every day. A pair of things that would be nice to add to your article would be how to provide a proxy to youtube-dl and youtube-dl taking links to download from a text file. Thx!
HD Video Converter Factory is also useful and it’s easier to use.
very nice program it works very well on fedora 27 good job thank u very much
Is there a way to get the current image from a live stream using youtube-dl? If not can you direct me to a command line application that can do this in Linux.
I am trying to capture an image from a live feed every 60 seconds so I can create a timelapse of the day.
Thanks
I believe you are not allowed to save the soundtracks from songs as you won’t have a legal license and thus are infringing the content owners copyright.
You should at least mention that in the article.
You wouldn’t like it if someone ripped all your website content and posted it online so they could read it without the adverts as you would say you are losing income.
Don’t be a d*ck.
I often use allavsoft to download all YouTube 1080p videos to 1080p, 720p, 480p, MP4, FLV, AVI, WMV, MKV, MOV, etc.
youtube-dl is pretty slow to start downloading or getting video title only (about 10s) on seagate dockstar, even after decompress.
What should I do to speed it up?
@Skyrail,
I use Youtube-DL everyday to download some videos or extract mp3 songs, but I never seen any slowness, it always fast…
how to play a downloaded video?
@Peter,
Install VLC Player in Linux to play all kind of video formats..
after download that music i suffer from how to execute/open/play that audio so what can i do?
Hi, I’m using Linux Mint for an operating System ! recently I have not been able to download Youtube Video ?? I have tries everything My small brain could come up with & no results ?? Anyone out there have any ideas ? Thanks in advance, Mike
@Mike,
Do you get any errors while running Youtube-DL? could you share with us? so that I can find out the solution for you.
You may try use Allavsoft to download 3sat TV programs, movies and other video clips in batch to your computer, laptop, tablet, mobile phone, iPad, PSP, Zune, X360, Smart TV, etc.
Do we have a limit call when using youtube-dl to request to Youtube. I’m afraid that Google might block me since I request many times.
@Trung,
No any limits applied by YouTube or Google, you can download as many as videos, like I do regularly download videos or mp3 tracks from Youtube without any trouble or issues..
Hi, thank you about this tip. I have a question: How to proceed if there are more than one video on the same url? I’d like to download all the videos, but youtube-dl see only one from the url, for instance this url about Docker self-paced-training course:
https://training.docker.com/self-paced-training
@Gilvan,
Yes, you can download list of videos from specific playlist, just check out the man pages of Youtube-DL here:
i like it a lot!
You might want to include the information on how to select or permanently set up a specific folder/path to download the file vs the home folder as the default location.
Maybe link to the youtube-dl FAQ https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-put-downloads-into-a-specific-folder
or
alter the information in the link in favor of the music folder as this specific article is about making them into mp3s.
Thank you for your suggestion Alfredo. Actually since there was quite an interest towards this article, I am thinking about either updating this one or writing a new one with a script that will allow you to easily manage your downloads, without passing this many parameters each time you download a track.
Hey Jeff. I understand your concern. It looks like the full source is available for download. Look here:
http://rg3.github.io/youtube-dl/download.html
If it helps, I have been using the youtube-dl script since Tecmint put out the original article in September with no weird side effects. (Running Linux Mint which is an Ubuntu variant.)
Chris
There are lot of Firefox extensions available. You can install one of them and download video and mp3, while you are watching them in Firefox. So No need to use YouTube.dl
Hello Jeff,
You don’t need to put the binary file in /usr/local/bin/. You can download it as regular user on your machine and place it in a directory by your choice from where you will access the file later. For example you can do:
wget https://yt-dl.org/downloads/latest/youtube-dl -O /home/tecmint/
And then run the file from /home/tecmint/
If you are interested in reviewing the documentation about youtube-dl, you can check the following link:
https://rg3.github.io/youtube-dl/
You’re ask us to use our root privileges to install a binary in a system executable directory without the source code? How do we know that this isn’t malware of some kind, or a social engineering attack?
I would really love to be able to do what you are doing, but without the source code, I’m not going to put it in a system directory.
Maybe on a virtual machine or on a chroot’d machine.
Source can be found here: https://github.com/rg3/youtube-dl
@Jeff Silverman
Great security concern there, may be you can check the source code out, i have used this program and i do not think from my assessment that it has any security concerns yet.
But who knows, issues such as the one you have raised have to be put into great consideration.
@Marin Todorov
Thanks for the great article
Apologies I didn’t have the time to provide the link to the source code of the application. I see that Josh already did that for me :)
Still, I haven’t heard for any problems with youtube-dl, but you may always download it to a different location if you don’t like the one provided in the article.
Nice Tutorial
Thanks a bunch. It was very straight forward using the package. Remain BLESSED!
I cannot dl the youtube-dl at all, what should I do?
@Ali,
May I know what error you getting on the screen while executing youtube-dl command?
Hi there,
I downloaded the file (successfully, I guess, since I didn’t get any error response), but I can’t find it anywhere. Is there a default destination where the files are saved after download?
@Nem,
By default youtube-dl downloads files in the current working directory i.e from where you run the command. If you want to download files to specific location then specify -o switch with location to place download files with youtube url as shown
Don’t use the repositories. Use the curl or wget method. Repositories are outdated.
Works for a lot of sites… https://rg3.github.io/youtube-dl/supportedsites.html
Home website for this program: https://rg3.github.io/youtube-dl/ :) Enjoy!
nice article
“youtube-dl –all-formats ” don’t work anymore as stated! Instead it starts downloading all the formats. Hence, use “youtube-dl –list-formats ” or “youtube-dl -F “. Then choose the format.
@Nitin,
We already mentioned about the same in the article, to download a list of video files, create a file with all YouTube links and run the following command to download them.
Thanks ravi your screenshot screenshot explainationation of how to download youtube-dl was spot on.
Thanks and appreciate you effort being an open source fan myself.
For that, wget is a good tool.
@Tanmaya,
Thanks for informing us, we’ve just updated the Youtube-DL article and included new installation instructions and usage of youtube-dl..
How about youtube-dl to download batch youtube links
Hi.Ravi. Can I twick this tool to download textbooks or other files?
@Mike,
No way, this tool is used to download files from Youtube only..
I am not able to find the downloaded files. where do I get it
@Arun,
I think it saves the downloaded file in current directory…
I had a problem for update:
youtube-dl -U
It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.
….
Ubuntu 14.04 LTS
Memori ram 15,5 GiB
Procer Intel Core i5-4430 CPU @ 3.00GHz x 4
Graphic Gallium 0.4 on NVD9
SO type 64 bits
hard disck 696,5 GB
dual partition with windows 8.1
how to download a series of videos with a single link?????
@ere,
To download a series of videos, create a file and add all the video links that you wish to download.
I have a downlaod that ended up zero sized. When I try to dewnload it again, youtube-dl tells me it’s aready dwonlaoded and gives up. How do I force a download? And where does youtube-dl save it’s setting etc. (I’m using Ububtu 12.04)?
Any thoughts? Thanks.
has this just recently stopped working? Did google/youtube changed something?
All of my old download tools have suddenly stopped working, anyone got any ideas, happened about 1-2weeks ago i think??
dude please provide a link for that wallpaper of yours
@Leme,
I don’t have a link to the wallpaper, sorry I don’t remember from where I get that…
Where can this video files are stored and how to change the default stored location………………THanku
The downloaded vidoes are stored in your current working directory only..
how to resume the youtube link while downloading it in terminal…………
great! its like dos…for me its more fun than click and go…and the commands make sense even though this is my first time. Thanks
Thanks !!!!
I’ve now been using youtube-dl successfully for 2 weeks now, thanks to this tutorial. Thanks for writing it.
how to specify a directory for the file download with youtube-dl
Doesn’t work for Debian after updating repositories..
http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/dists/wheezy/main/source/Sources 404 Not Found
Doesnt work for Kali linux.
sudo add-apt-repository ppa:nilarimogard/webupd8
any suggestion?
A couple of Question –
1. Is there a GUI Client for Windows
2. Can I change the location of stored files , config file.
Between this publication and 12 July 2013, the command-line options have changed. For example, the dash-capital-F “-F” option is no longer present. To fetch all formats for the named URL you now use “–all-formats”. I leave other details to the student.
Also, after you install from the PPA, I had to run the program twice using ‘sudo’ permissions (to enable write into the install location) and with the “–update” option. The program reported as follows:
==========
Hi! We changed distribution method and now youtube-dl needs to update itself one more time.
This will only happen once. Simply press enter to go on. Sorry for the trouble!
From now on, get the binaries from http://rg3.github.io/youtube-dl/download.html, not from the git repository.
==========
I hope these notes save others some confusion.
~~~ 0;-Dan
Thanks, as per your new changes, I’ve modified the article.
Incorrect – incomplete information
It does the trick, but there are loads of options available as extensions / plugins to Firefox / Chrome if you use one of those. The extensions allow you to download video in a couple of clicks – some with format conversion options at the same time if you want. Much quicker and less hassle to use than firing up the terminal and pasting in the url. Just have a browse through the extensions and pick one of those instead…
ClipGrab is better
movgrab is better :)